<%@ include file="../taglib.jsp"%>
<script type="text/javascript"
	src="<spring:message code="domain"/>/js/controller/admin/parsesite-controller.js"></script>
<div class="container-fluid" ng-controller="ParseSiteCtrl">
	<div class="container-fluid">
		<div class="row-fluid form-inline">
			<table>
				<tr>
					<td>Store:</td>
					<td><select ng-model="parsePageRq.storeId"
						ng-options="store.id as store.name for store in stores">
					</select></td>
				</tr>
				<tr>
					<td colspan="2"><input type="button" id="btnParse" class="btn"
						value="Parse" ng-click="parse()" style="width: 100px;" /> <img
						id="loader" alt=""
						src="<spring:message code="domain"/>/img/loader.gif"
						style="display: none;"></td>
				</tr>
			</table>
		</div>
	</div>

	<div id="results" class="container-fluid" style="padding-top: 20px;">

		<ul class="nav nav-tabs">
			<li class="active"><a href="#tab1" data-toggle="tab">
					<h6>
						Updated Products: <font color="red">{{result.updates.length}}</font>
					</h6>
			</a></li>
			<li><a href="#tab2" data-toggle="tab"><h6>
						Classified New Products: <font color="red">{{result.definedNews.length}}</font>
					</h6> </a></li>
			<li><a href="#tab3" data-toggle="tab"><h6>
						Unclassified New Products: <font color="red">{{result.unDefinedNews.length}}</font>
					</h6> </a></li>
		</ul>

		<div class="tab-content">
			<!-- UPDATE PRODUCT -->
			<div id="tab1" class="tab-pane active">
				<div id="updateDiv" class="container-fluid whitebg">
					<div>
						<div class="row-fluid form-inline"
							style="padding: 10px 0px 10px 0px;">
							<strong>Filter:</strong><input type="text"
								ng-model="searchUpdate">
						</div>
						<table class="table">
							<thead>
								<tr>
									<th>Id</th>
									<th>Product Name</th>
									<th>Price</th>
									<th>Class</th>
								</tr>
							</thead>
							<tbody>
								<tr ng-repeat="product in result.updates | filter:searchUpdate">
									<td>{{product.id}}</td>
									<td>{{product.name}}</td>
									<td>{{product.price}}</td>
									<td>{{product.className}}</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
			</div>

			<!-- DEFIED NEW PRODUCT -->
			<div id="tab2" class="tab-pane">
				<div id="classifiedDiv" class="container-fluid whitebg tab-pane">
					<div>
						<div class="row-fluid form-inline"
							style="padding: 10px 0px 10px 0px;">
							<strong>Filter:</strong><input type="text"
								ng-model="searchDefined">
						</div>
						<table class="table">
							<thead>
								<tr>
									<th>Id</th>
									<th>Product Name</th>
									<th>Price</th>
									<th>Class</th>
								</tr>
							</thead>
							<tbody>
								<tr
									ng-repeat="product in result.definedNews | filter:searchDefined ">
									<td>{{product.id}}</td>
									<td>{{product.name}}</td>
									<td>{{product.price}}</td>
									<td>{{product.className}}</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
			</div>

			<!-- UNDEFIED NEW PRODUCT -->
			<div id="tab3" class="tab-pane">
				<div id="unclassifiedDiv" class="container-fluid whitebg tab-pane">
					<div>
						<div class="row-fluid form-inline"
							style="padding: 10px 0px 10px 0px;">
							<strong>Filter:</strong><input type="text"
								ng-model="searchUndefined">
						</div>
						<table class="table">
							<thead>
								<tr>
									<th>Product Name</th>
									<th>Price</th>
									<th>Class</th>
									<th>Link</th>
									<th></th>
								</tr>
							</thead>
							<tbody>
								<tr
									ng-repeat="product in result.unDefinedNews | filter:searchUndefined">
									<td>{{product.name}}</td>
									<td>{{product.price}}</td>
									<td><select style="width: 200px;"
										ng-model="product.categoryId"
										ng-options="c.id as c.name for c in cat"></td>
									<td><a target="_blank"
										ng-href="{{result.unDefinedNewsDetail[$index].detailUrl}}">View</a></td>
									<td><input type="button" value="Insert"/></td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>

</div>